﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DLM.Infrastructure.Domain;

namespace DLM.Domain.Model
{
    public class UserView : IValidatableObject, IAggregateRoot
    {
        public int ViewID { get; set; }
        public int UserID { get; set; }
        public string IP { get; set; }
        public System.DateTime ViewDate { get; set; }

        public virtual User User { get; set; }

        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (UserID < 0)
            {
                yield return new ValidationResult("用户编号不允许为空", new string[] { "UserID"});

            }
        }
    }
}
